
/**
 * @author jiangqifan
 * @since 2016-5-26
 */

(function(){
  ADF.policy.SnapPolicy = function(){
    ThisClass.superclass.constructor.call(this);
	
	this.policiesHasLineFeedback = new Array();
	this.lineFeedbacks = new Array();
  }

  var ThisClass = ADF.policy.SnapPolicy;

  //static properties
  COM.util.defineClass(ThisClass, COM.gef.ConstrainedLayoutEditPolicy, {
    
    getConstraintFor: function(request, child) {
      var rectangle = new COM.draw2d.Rectangle(), childBoundsCopy = child.getModel().getBounds().copy(),
          childFigure = child.getFigure(), moveData = request.getMoveDelta();
      childFigure.translateToAbsolute(childBoundsCopy);
      var relativeLoaction = new COM.draw2d.Point(childBoundsCopy.x + moveData.x , childBoundsCopy.y + moveData.y);
      rectangle.setLocation(relativeLoaction);
      rectangle.setSize(child.getFigure().getBounds().getSize());
      return rectangle;
    },

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	
	// 	getFor : function(host){
// 		var layout = null;
// 		if(host!=null&&host!="undefined"){
			
// 		}
// 		return new UIEditor.UIXYLayoutEditPolicy();
// 	},
	
	getCommand : function(request){
		return null;
// //		if (REQ_PASTE.equals(request.getType()))
// //			return getPasteCommand((PasteRequest) request);
// //		if (REQ_MOVE_CHILDREN.equals(request.getType()))
// //			return getResizeChildrenCommand((ChangeBoundsRequest)request);
// 		if(COM.gef.RequestConstants.REQ_DELETE == request.getType())
// 			return this.getDeleteChildrenIncident(request,host);
// 		if(COM.gef.RequestConstants.REQ_MOVE == request.getType() || COM.gef.RequestConstants.REQ_RESIZE == request.getType()){
// 			if(request.getCause)
// 				if(request.getCause() == "vernier_changebounds")
// 					return this.getVernierChangeConstraintCommand(request,host);
// 		}
// 		return UIEditor.UIXYLayoutEditPolicy.superclass.getIncident.call(this,request,host);
	},
	
// 	getVernierChangeConstraintCommand : function(request,host){
// 		var child = request.getEditParts()[0];
// 		var direction = request.getDirection();
// 		var moveDelta = request.getMoveDelta();
// 		var sizeDelta = request.getSizeDelta();
		
// 		var oldBound = child.getFigure().getBounds().getCopy();
// 		var newBound = oldBound.getCopy();
// 		newBound.x = oldBound.x + moveDelta.x;
// 		newBound.y = oldBound.y + moveDelta.y;
// 		newBound.width = oldBound.width + sizeDelta.width;
// 		newBound.height = oldBound.height + sizeDelta.height;
		
// 		if(newBound.x<0) { newBound.x = 0; }
// 		if(newBound.y<0) { newBound.y = 0; }
		
// 		var inc = new UIEditor.DesignPanelIncident(host.getId() , UIEditor.DesignPanelIncident.XY_TYPE_GRAPHIC_MOVE );
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_POSITION_X, oldBound!=null?oldBound.x:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_POSITION_Y, oldBound!=null?oldBound.y:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_SIZE_WIDTH, oldBound!=null?oldBound.width:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_SIZE_HEIGHT, oldBound!=null?oldBound.height:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_X, newBound!=null?newBound.x:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_Y, newBound!=null?newBound.y:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_WIDTH, newBound!=null?newBound.width:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_HEIGHT, newBound!=null?newBound.height:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_CHILD_ID, child.getId());
// 		return inc;
// 	},
	
// 	getDeleteChildrenIncident : function(request,host){
// 		var child = request.getEditParts()[0];
// 		var inc = new UIEditor.DesignPanelIncident(host.getId() , UIEditor.DesignPanelIncident.XY_TYPE_GRAPHIC_CHILD_DELETE );
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_CHILD_ID, child.getId());
// 		return inc;
// 	},
	
// 	getTargetEditPart : function(request,host){
// 		//��Ҫ���¶���
// //		if (REQ_PASTE.equals(request.getType()))
// //			return host;
// 		return UIEditor.UIXYLayoutEditPolicy.superclass.getTargetEditPart.call(this,request,host);
// 	},
	
// 	// override
// 	createChangeConstraintIncidentWithRequest : function(request,child,constraint,host){
// 		var oldBound = child.getFigure().getBounds().getCopy();
// 		constraint.x = (constraint.x < 0 ? 0 : constraint.x);
// 		constraint.y = (constraint.y < 0 ? 0 : constraint.y);
		
		
// 		var inc = new UIEditor.DesignPanelIncident(host.getId() , UIEditor.DesignPanelIncident.XY_TYPE_GRAPHIC_MOVE );
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_POSITION_X, oldBound!=null?oldBound.x:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_POSITION_Y, oldBound!=null?oldBound.y:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_SIZE_WIDTH, oldBound!=null?oldBound.width:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.OLD_DATA_SIZE_HEIGHT, oldBound!=null?oldBound.height:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_X, constraint!=null?constraint.x:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_Y, constraint!=null?constraint.y:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_WIDTH, constraint!=null?constraint.width:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_HEIGHT, constraint!=null?constraint.height:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_CHILD_ID, child.getId());
// 		return inc;
// 	},
// 	createChangeConstraintIncident : function(child,constraint,host){
// 		return null;
// 	},
	
// 	getCreateIncident : function(request,host){
// 		var inc = new UIEditor.DesignPanelIncident(host.getId() , UIEditor.DesignPanelIncident.XY_TYPE_GRAPHIC_CREATE);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_CREATE_ACTIVETOOL , request.getCreationType());
// 		var COM.draw2d.Point = request.getLocation().getCopy();
// 		host.getFigure().translateToRelative(COM.draw2d.Point);
// 		host.getFigure().translateFromParent(COM.draw2d.Point);
// //		this.translate(host.getFigure()._eid, COM.draw2d.Point);
// 		if(COM.draw2d.Point.x < 0 || COM.draw2d.Point.y < 0) {
// 			this.eraseCreateFlagFeedback(host);
// 			return null;
// 		}
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_X , COM.draw2d.Point.x);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_Y , COM.draw2d.Point.y);
// 		var cell = UIEditor.designerPanelToolKit.getCellPoint(host.getFigure()._eid , COM.draw2d.Point.x , COM.draw2d.Point.y);
// 		if(cell){
// 			inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_COLUMN , cell.x);
// 			inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_ROW , cell.y);
// 		}
// 		if(request.getSize()!=null){
// 			var size = request.getSize().getCopy();
// 			host.getFigure().translateToRelative(size);
// 			host.getFigure().translateFromParent(point);
// 			inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_WIDTH , size.width);
// 			inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_SIZE_HEIGHT , size.height);
// 		}
// 		return inc;
// 	},
// 	/**
// 	 * ճ��������ע�ֽ׶��Ȳ�֧��
// 	 */
// 	getPasteIncident : function(request,host){
// 		return null;
// 	},
	
// 	createAddIncident : function(child,constraint , host){
// 		var inc = new UIEditor.DesignPanelIncident(host.getId() , UIEditor.DesignPanelIncident.XY_TYPE_GRAPHIC_CHILD_ADD)
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_X, constraint!=null?constraint.x:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_POSITION_Y, constraint!=null?constraint.y:undefined);
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_CHILD_ID, child.getId());
// 		inc.setArgumentByKey(UIEditor.DesignPanelIncident.DATA_PARENT_ID, child.getParent().getId());
// 		return inc;
// 	},
	
// 	getCloneIncident : function(request,host){
// 		//�ֽ׶β�֧��
// 		return null;
// 	},
	
	eraseLayoutTargetFeedback : function(request){
		this.eraseLocationFeedback();
		this.eraseSizeFeedback();
		this.eraseLineFeedback();
	},
	
	eraseLocationFeedback : function(){
		if (this.locationFeedback != undefined && this.locationFeedback != null) {
			this.removeFeedback(this.locationFeedback.getFigure());
			this.locationFeedback = null;
		}
	},
	
	eraseSizeFeedback : function(){
		if (this.sizeFeedback != undefined && this.sizeFeedback != null) {
			this.removeFeedback(this.sizeFeedback.getFigure());
			this.sizeFeedback = null;
		}
	},
	
	eraseCreateFlagFeedback : function(){
		if (this.createFlagFeedback != undefined && this.createFlagFeedback != null) {
			this.removeFeedback(this.createFlagFeedback.getFigure());
			this.createFlagFeedback = null;
		}
	},
	
	eraseLineFeedback : function(){
		if (!this.lineFeedbacks.length == 0) {
			for (var i = 0 ; i < this.lineFeedbacks.length; i++) {
				this.removeSubFeedback(this.lineFeedbacks[i]);
			}
			this.lineFeedbacks.length = 0;
			COM.util.Array.removeItem(this.policiesHasLineFeedback , this);
		}
	},
	
	/**
	 * @overwride
	 */
	eraseTargetFeedback : function(request){
		if (COM.gef.RequestConstants.REQ_ADD == (request.getType())
				|| COM.gef.RequestConstants.REQ_CLONE == (request.getType())
				|| COM.gef.RequestConstants.REQ_MOVE == (request.getType())
				|| COM.gef.RequestConstants.REQ_MOVE_CHILDREN == (request.getType())
				|| COM.gef.RequestConstants.REQ_RESIZE == (request.getType())
				|| COM.gef.RequestConstants.REQ_RESIZE_CHILDREN == (request.getType())
				|| COM.gef.RequestConstants.REQ_CREATE == (request.getType())
				|| COM.gef.RequestConstants.REQ_PASTE == (request.getType()))
			this.eraseLayoutTargetFeedback(request);

		if (COM.gef.RequestConstants.REQ_CREATE == (request.getType())){
			this.eraseSizeOnDropFeedback(request);
		    this.eraseCreateFlagFeedback();
		}
	},
	
	/**
	 * overwride
	 */
	eraseSizeOnDropFeedback : function(request){
		this.eraseSizeFeedback();
		this.isa = "SnapPolicy";
		return ADF.policy.SnapPolicy.superclass.eraseSizeOnDropFeedback.call(this,request);
	},
	
	showTargetFeedback : function(request){
		//�����������������һ�ȥ����request
		if(COM.gef.RequestConstants.REQ_RESIZE == (request.getType())
				|| COM.gef.RequestConstants.REQ_ADD == (request.getType())
				|| COM.gef.RequestConstants.REQ_MOVE == (request.getType())){
			this.showLineFeedback(request);
		}
		
		if (COM.gef.RequestConstants.REQ_ADD == (request.getType())
				|| COM.gef.RequestConstants.REQ_CLONE == (request.getType())
				|| COM.gef.RequestConstants.REQ_MOVE == (request.getType())
				|| COM.gef.RequestConstants.REQ_MOVE_CHILDREN == (request.getType())
				|| COM.gef.RequestConstants.REQ_RESIZE == (request.getType())
				|| COM.gef.RequestConstants.REQ_RESIZE_CHILDREN == (request.getType())
				|| COM.gef.RequestConstants.REQ_CREATE == (request.getType())
				|| COM.gef.RequestConstants.REQ_PASTE == (request.getType()))
			this.showLayoutTargetFeedback(request);

		if (COM.gef.RequestConstants.REQ_CREATE == (request.getType())) {
			this.showCreateFeedback(request);
		}
		
		
	},
	
	showLineFeedback : function(request){
		host = this.getHost();
		var editparts = request.getEditParts();
		var compoundSrcRect = null;
		var sourceRectangle = null;
		for(var i =0 ; i < editparts.length ; i++){
			var editpart = editparts[i];
			var figure = editpart.getFigure();
			var sourceRect = figure.getBounds().getCopy();
			if(COM.gef.RequestConstants.REQ_RESIZE== (request.getType())){
				var  rect = sourceRect.getCopy();
				figure.translateToAbsolute(rect);
				rect.translate(request.getMoveDelta());
				rect.resize(request.getSizeDelta());
				var result = new COM.draw2d.Point();
				this.getSnapToHelper(host).snapRectangle(request , request.getResizeDirection(),
						rect, result , editpart);
				
				if (request.isCenteredResize()) {
					if (result.x != 0)
						result.width(result.width - result.x);
					else if (result.width() != 0) {
						result.x = -result.width();
						result.width = result.width * 2;
					}

					if (result.y != 0)
						result.height = result.height - result.y;
					else if (result.height() != 0) {
						result.y = -result.height;
						result.height = result.height * 2;
					}
				}
				var movex = request.getMoveDelta().x;
				var movey = request.getMoveDelta().y;
				var resizeW = result.x + request.getSizeDelta().width;
				var resizeH = result.y + request.getSizeDelta().height;
				
				if(movex != 0){
					movex += result.x;
					resizeW -= 2 * result.x
				}
				if(movey != 0){
					movey += result.y;
					resizeH -= 2 * result.y
				}
				var move = new COM.draw2d.Point(movex, movey);
				var resize = new COM.draw2d.Dimension(resizeW, resizeH);

				request.setMoveDelta(move);
				request.setSizeDelta(resize);
				editpart.showSourceFeedback(request);
			}
			
			if(COM.gef.RequestConstants.REQ_MOVE == (request.getType()) || COM.gef.RequestConstants.REQ_ADD == (request.getType())){
				figure.translateToAbsolute(sourceRect);
				if(compoundSrcRect == null)
					var compoundSrcRect = sourceRect.getCopy();
				else
					compoundSrcRect = compoundSrcRect.union(sourceRect);
				if(editpart == host.getViewer().getFocusEditPart())
					sourceRectangle = sourceRect;
				}
		}
		
		if(COM.gef.RequestConstants.REQ_MOVE == (request.getType()) || COM.gef.RequestConstants.REQ_ADD == (request.getType())){
			if(sourceRectangle == null){
				var figure = host.getViewer().getSelection()[0].getFigure();
				sourceRectangle = figure.getBounds().getCopy();
				figure.translateToAbsolute(sourceRectangle);
			}
			var result = request.getMoveDelta().getCopy();
			var rects = new Array();
			sourceRectangle.translate(request.getMoveDelta());
			rects.push(sourceRectangle);
			if(compoundSrcRect) {
				compoundSrcRect.translate(request.getMoveDelta());
				rects.push(compoundSrcRect);
			}
			this.getSnapToHelper(host).snapPoint(request, COM.draw2d.PositionConstants.HORIZONTAL | COM.draw2d.PositionConstants.VERTICAL, rects , result);
			request.setMoveDelta(result);
		}
		
	},
	
	getSnapToHelper : function(host){
		if(this.snapToHelper == null){
			this.snapToHelper = new ADF.util.SnapToElement();
			this.snapToHelper.setEditpolicy(this);
		}
		this.snapToHelper.setHostPart(this.getHost());
		return this.snapToHelper;
	},
	
	addLineFeedback : function(startPoint , endPoint){
		this.eraseOtherLineFeedback(this);
		var p1 = startPoint.getCopy();
		var p2 = endPoint.getCopy();
		var layer = this.getFeedbackLayer();
		layer.translateToRelative(p1);
		layer.translateToRelative(p2);
		var line = new ADF.util.DashedPolyline(5 , 5);
		this.initFeedbackLine(line);
		line.addPoint(p1);
		line.addPoint(p2);
		var lineFeedback = line;
		this.addSubFeedback(lineFeedback);
		this.lineFeedbacks.push(lineFeedback);
		if (!COM.util.Array.contains(this.policiesHasLineFeedback , this)) {
			this.policiesHasLineFeedback.push(this);
		}
	},
	
	eraseOtherLineFeedback : function(except){
		if (this.policiesHasLineFeedback.length == 0) {
			return;
		}
		for (var i =0; i < this.policiesHasLineFeedback.length; i++) {
			if (this.policiesHasLineFeedback[i] != except) {
				 this.policiesHasLineFeedback[i].eraseLineFeedback();
			}
		}
	},
	
	addSubFeedback : function(feedback){
		this.getFeedbackLayer().add(feedback);
	},
	
	removeSubFeedback : function(feedback){
		this.getFeedbackLayer().remove(feedback);
	},
	
	initFeedbackLine : function(line){
		line.setLineWidth(2);
		line.setOutlineColor(COM.draw2d.ColorConstants.red);
	},
	
	showLayoutTargetFeedback : function(request){
		host = this.getHost();
		var bounds = null;
		if (COM.gef.RequestConstants.REQ_MOVE == request.getType()
				|| COM.gef.RequestConstants.REQ_MOVE_CHILDREN == request.getType()
				|| COM.gef.RequestConstants.REQ_RESIZE == request.getType()
				|| COM.gef.RequestConstants.REQ_ADD == request.getType()
				|| COM.gef.RequestConstants.REQ_RESIZE_CHILDREN == request.getType()) {
			if (request.getEditParts() == null || request.getEditParts().length == 0) {
				return;
			}
			var child = request.getEditParts()[0];
			bounds = this.translateToModelConstraint(this.getConstraintForChangeBounds(
					request, child));
			if (COM.gef.RequestConstants.REQ_MOVE == request.getType()
				|| COM.gef.RequestConstants.REQ_MOVE_CHILDREN == request.getType() || COM.gef.RequestConstants.REQ_ADD == request.getType()) {
				this.doShowLocationFeedback(bounds);
			}
			if (COM.gef.RequestConstants.REQ_RESIZE == request.getType()
				|| COM.gef.RequestConstants.REQ_RESIZE_CHILDREN == request.getType()) {
				this.doShowSizeFeedback(bounds);
			}
		}

		if (COM.gef.RequestConstants.REQ_CREATE == request.getType()
				|| COM.gef.RequestConstants.REQ_PASTE == request.getType()){
			bounds = this.getConstraintForCreate(request);
			this.doShowLocationFeedback(bounds);
			this.doShowSizeFeedback(bounds);
		}
	},
	
	showCreateFeedback : function(request){
		if (request.getSize() == null){
			var d = new COM.draw2d.Dimension(0,0);
			request.setSize(d);
		}
		this.showSizeOnDropFeedback(request);
		
		this.showCreateFlagFeedback(request);
	},
	
	showSizeOnDropFeedback : function(request){
		ADF.policy.SnapPolicy.superclass.showSizeOnDropFeedback.call(this,request);
		var bounds = this.getConstraintForCreate(request);
		this.doShowLocationFeedback(bounds);
		this.doShowSizeFeedback(bounds);
	},
	
	getAbsoluteFromChild : function(bounds) {
		host = this.getHost();
		var traned = bounds.getCopy();
		var figure = host.getFigure();
		figure.translateToParent(traned);
		figure.translateToAbsolute(traned);
		return traned;
	},
	
	doShowLocationFeedback : function(bounds){
		if(bounds.x < 0 || bounds.y < 0) 
			return;

		var feedback = this.getLocationFeedback();
		var label = feedback.getLabel();
		var figure = feedback.getFigure();
		
		var size = figure.getSize();
		var location = this.getAbsoluteFromChild(bounds).getTopLeft().translate(-8 - size.width , -8 - size.height);
		figure.translateToRelative(location);
		figure.setLocation(location);

		var text = bounds.x+","+bounds.y;
		feedback.setText(text);

		figure.repaint();
	},
	getLocationFeedback : function(){
		if (this.locationFeedback == undefined || this.locationFeedback == null) {
			var feedback = new ADF.util.LabelFeedback(this.getFeedbackLayer(), "");
			feedback.setBackgroundColor(COM.draw2d.ColorConstants.yellow);
			this.locationFeedback = feedback;
			this.addFeedback(this.locationFeedback.getFigure());
		}
		return this.locationFeedback;
	},
	
	doShowSizeFeedback : function(bounds){
		if(bounds.width < 0 || bounds.height < 0)
			return ;
		var text = bounds.width+","+bounds.height;
		var location = this.getAbsoluteFromChild(bounds).getBottomRight().translate(12, 8);
		var feedback = this.getSizeFeedback();
		feedback.setText(text);
		feedback.getFigure().setLocation(location);
		feedback.getFigure().repaint();
	},
	
	getSizeFeedback : function(){
		if (this.sizeFeedback ==undefined || this.sizeFeedback == null) {
			var feedback = new ADF.util.LabelFeedback(this.getFeedbackLayer(), "");
			feedback.setBackgroundColor(COM.draw2d.ColorConstants.yellow);
			this.sizeFeedback = feedback;
			this.addFeedback(this.sizeFeedback.getFigure());
		}
		return this.sizeFeedback;
	},
	
	showCreateFlagFeedback : function(request){
		var bounds = this.getConstraintForCreate(request);
		if(bounds.x < 0 || bounds.y < 0 || (bounds.width>0 && bounds.height>0)) {
			this.eraseCreateFlagFeedback();
			return;
		}
		bounds = this.getAbsoluteFromChild(bounds);
		var feedback = this.getCreateFlagFeedback();

		var location = new COM.draw2d.Point(bounds.x + 15, bounds.y + 10);
		feedback.getFigure().translateToRelative(location);
		if (location.x < 0) {
			location.x = 0;
		}
		if (location.y < 0) {
			location.y = 0;
		}
		
		feedback.getFigure().setLocation(location);
		feedback.getFigure().repaint();
	},
	
	
	getCreateFlagFeedback : function(){
		if (this.createFlagFeedback == undefined || this.createFlagFeedback == null) {
			var feedback = new ADF.util.LabelFeedback(this.getFeedbackLayer(), "");
			// feedback.setIcon(UIEditor.UIXYLayoutEditPolicy.OK_IMAGE);
//			feedback.setBackgroundColor(COM.draw2d.ColorConstants.white);
			feedback.panel.setBorder(null);
			this.createFlagFeedback = feedback;
			this.addFeedback(this.createFlagFeedback.getFigure());
		}
		return this.createFlagFeedback;
	},
	
	
// 	eraseCellsFeedback : function(){
// 		if (this.freeCellsFeedbacks != null) {
// 			for (var i =0 ;i<this.freeCellsFeedbacks.length ; i++) {
// 				COM.util.Array.remove(this.freeCellsFeedbacks , i);
// 			}
// 			this.freeCellsFeedbacks = undefined;
// 		}
// 	},

// 	getMinimumSizeFor: function(child){
// 		if (child instanceof UIEditor.NonDiagonalLineEditPart) {
// 			return new COM.draw2d.Dimension(1,1);
// 		} else
// 		return new COM.draw2d.Dimension(8, 8);
// 	},

	/**
	 * overwride
	 */
	 getConstraintForRectangle : function(rectangle){
		 return rectangle;
	 }
  });

})();